function singlePostController($scope,$state,$http,$stateParams,$sce){
    var postId = $stateParams.postId;
    
    $http({
        url: '/post/getPostById/'+postId,
        method: 'GET',
    }).success(function (response) {
        
                console.log("response: " + response);
                $scope.post = response;
                $scope.trustHtml = $sce.trustAsHtml(response.component)
        
        
            }).error(function (response) {
                alert('error')
            })

    $scope.deletePost = function(){
        $http({
            url:'/post/deletePost/'+postId,
            method:'POST',
        }).success(function(response){
            console.log("response: " + response);
            alert('删除成功');
            $state.go('postBar');
        }).error(function (response) {
            alert('error')
        })
        
    }

    $scope.openUpdatePost = function(){
        $state.go('addPost',{postId : postId,addFlag : false});
    }
    
}

